﻿package net.wangit.adm.log;

import net.wangit.MapList;
import net.wangit.context.ActionContext;
import net.wangit.context.LocalContext;
import net.wangit.jdbc.DB;
import net.wangit.jdbc.DBFactory;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class LogChartUtil {

	private static final Log log = LogFactory
			.getLog(net.wangit.adm.log.LogChartUtil.class);

	public LogChartUtil() {
	}

	public static MapList getMapList(String sql) {
		try {
			String domain;
			ActionContext ac = LocalContext.getLocalContext()
					.getActionContext();
			domain = ac.getRequestParameter("domain", "app");
			DB db = DBFactory.getDB();
			return db.query(sql, domain, 2);
		} catch (Exception e) {
			log.error((new StringBuilder("log chart error: ")).append(e)
					.toString());
			return null;
		}
	}

}
